package com.agent.generator.rabbitmq;

import com.agent.generator.config.AiGenerateRabbitConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * AI生成任务消息生产者
 * @author Jeff_Wan
 * @description 向消息队列发送生成任务
 */
@Service
public class AiGenerateProducer {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Autowired
    private AiGenerateRabbitConfig rabbitConfig;

    /**
     * 发送AI生成请求
     */
    public void sendTaskMessage(Long taskId) {
        rabbitTemplate.convertAndSend(
                rabbitConfig.getExchange(),
                rabbitConfig.getRoutingKey(), taskId);
    }
}